<?php
    echo Modules::run('ndh/header');
?>
<div class="clear" style="padding-bottom: 5px;"></div>   
        <div id="mainContent" style="width: 987px;">
            <table width="987" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                <tr valign="top">
                    <td>
                        <div id="leftContent" style="background-color: #FFFFFF;">
                        <?php
                        if(!empty($news))
                        {
                            $fist_news_id = $news['id'];
                        ?>
                            <div style="padding: 10px 10pt 10pt; background-color: #FFFFFF;">
                                <h1><?php echo $news['title']; ?></h1>
                            </div>
                            <div class="mainDetail">
                            <?php echo html_entity_decode($news['detail'],ENT_QUOTES,'UTF-8'); ?>
                            </div>
                            
                            <div style="padding:10px;border-top: 3px solid #EEEEEE; background-color: #FFFFFF;">
                                <h1>NHẬN ĐỊNH KHÁC</h1>
                                <div id="otherNews">
                                <ul>
                                    <?php   
                                    foreach($other_news as $news)
                                    {
                                        if($news['id'] == $fist_news_id) continue;
                                    ?>
                                    <li><a href="<?php echo site_url('ndh/nhandinhthitruong/'.$news['id'].'/') ?>"><?php echo $news['title']; ?></a></li>
                                    <?php
                                    }
                                    ?>
                                </ul>
                                </div>
                            </div>
                        <?php
                        }
                        ?>
                        </div>
                    </td>
                    <td><div id="rightContent" style="height: auto;">
                <!-- index table -->
                <div id="indextbl">Index</div>
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">
                <?php 
                require_once "simple_html_dom.php";
                $url = "http://www.bloomberg.com/";
                $html = file_get_html($url);

                $us = $html->find('div[id=market_snap_us]',0)->outertext;
                $europe = $html->find('div[id=market_snap_europe]',0)->outertext;
                $asia = $html->find('div[id=market_snap_asia]',0)->outertext;
                ?>
                    <ul>
                        <li><a id="US" href="#">Mỹ</a></li>
                        <li><a id="Europe" href="#">Châu Âu</a></li>
                        <li><a id="Asia" href="#">Châu Á</a></li>
                    </ul>
                    <br/>
                    <div id="indexUS">
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$us); ?> 
                    </div>
                    <div id="indexEurope" style="display: none;"> 
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$europe); ?>
                    </div>
                    <div id="indexAsia" style="display: none;">
                       <?php echo str_replace('/quote/','http://www.bloomberg.com/quote/',$asia); ?>
                    </div>
                    <script>          
                       $("#US").click(function() {
                          $('#indexUS').show('slow');
                          $('#indexEurope').hide();
                          $('#indexAsia').hide();
                        });
                         
                       $("#Europe").click(function() {
                          $('#indexEurope').show('slow');
                          $('#indexUS').hide();
                          $('#indexAsia').hide();
                        });

                       $("#Asia").click(function() {
                          $('#indexAsia').show('slow');
                          $('#indexEurope').hide();
                          $('#indexUS').hide();
                        });
                    </script>
                    <br/>
                </div>
                <!-- index table -->
                
                <br/>
                <!-- nha dau tu -->
                <div id="indextbl">Nhà đầu tư</div>  
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">
                <table id="nhadautu" border="1" width="100%" style="background-color: #FFFFFF;">
                    <tr style="height: 24px;" align="center">
                        <td colspan="3" width="50%" style="border-right: 1px solid #CCCCCC;">NDT NƯỚC NGOÀI</td>
                        <td colspan="3" width="50%">NDT TRONG NƯỚC</td>
                    </tr>
                    <tr style="height: 24px;" align="center">
                        <th>&nbsp;</th>
                        <th>Mua</th>
                        <th>Bán</th>
                        <th>&nbsp;</th>
                        <th>Mua</th>
                        <th>Bán</th>
                    </tr>                    
                    <tr>
                    <?php
                            foreach( $investor_foreign as $investor )
                            {
                    ?>
                        <td class="alt3"><?php echo $investor['name'] ?></td><td class="alt2"><?php echo $investor['buy'] ?></td><td class="alt2"><?php echo $investor['sell'] ?></td>
                        <?php
                            }
                        ?>
                    </tr>
                    <tr>
                        <?php
                            foreach( $investor_data as $investor )
                            {
                        ?>
                        <td class="alt3"><?php echo $investor['name'] ?></td><td class="alt2"><?php echo $investor['buy'] ?></td><td class="alt2"><?php echo $investor['sell'] ?></td>
                        <?php
                            }
                        ?>
                    </tr>
                
                </table>
                </div>
                <!-- nha dau tu -->
                <br/>
                <!-- bao cao phan tich -->
                <div id="indextbl">BÁO CÁO PHÂN TÍCH</div>  
                <div id="indexcontent" style="background-color: #FFFFFF;" class="halfmoon">                    
                    <?php
                        foreach($analyze_reports as $report)
                        {
                    ?>
                        <p>&raquo; <a href="<?php echo base_url(); ?>uploads/company/report/<?php echo $report['upload'] ?>" target="blank" class="normalNews"><?php echo $report['title'] ?></a></p>            
                    <?php
                        }
                    ?>
                </div>
                <!-- bao cao phan tich -->
            </div></td>
                </tr>
            </table>
        </div>
        <div class="clear" style="height: 2px; background-color: #FFFFFF; width: 987;"></div>
<?php
    echo Modules::run('ndh/footer');
?>